import React from "react";
import copy from 'copy-to-clipboard';
import stylesMy from '../css/My.css';
import styles from '../css/Project.css';

class My extends React.Component {

    constructor(props, context) {
        super(props, context);
        this.userphones = this.props.location.state.userphones;
        console.log('-----', this.props.location.state.userphones);
        this.tui_phone=this.props.location.state.tui_phone;
        this.url = this.props.location.state.url;

    }

    render(){
        return(
            <div>
            <div id="bodyDiv" className={styles["Project-layoutBody"]}>
                <div id="bodyDivCenter" className={stylesMy["My-Layout-center"]}>
                    <div className={stylesMy["My-CenterDiv"]}>
                        <label className={stylesMy["My-textCenter"]}>账号：</label>{this.userphones}</div>
                <br/>
                    <div className={stylesMy["My-CenterDiv"]}>
                        <br/>
                        <br/>  <br/>


                        上级推广商手机号：<br/>{this.tui_phone}
                <br/>
                <br/>
                        <div className={stylesMy["My-div1"]}>
                <button className={stylesMy["My-button"]} onClick={() => this.updates()}>修改</button></div>
                    </div>


                    <br/>
                    <br/>
                    <br/>
                    <div className={stylesMy["My-Top"]}></div>
                    <div className={stylesMy["My-CenterDiv"]}>
                        推广网址地址：<br/>{this.url}</div>
                    <div className={stylesMy["My-div1"]}>
                        <br/>
                        <br/>
                        <br/>
                        <br/>
                        <button className={stylesMy["My-button"]} onClick={() => this.copyUrl()}>复制</button></div>
                </div>
            </div>
            </div>
        )
    }

    updates() {
        alert('请联系客服人员修改推荐人；\n' +
            '客服会在调查核实后给予修改。\n' +
            '客服电话：02885283249')
    }


    copyUrl = () => {
        copy(this.url);
        alert('复制成功');
    };
}
export default My;